package com.software.graduationproject.commons.enums;

import com.v2coding.validate.BaseEnum;

/**
 * GenderType : 性别
 * ---------------------------------------------------------------------------------------------------------------------
 */
public enum GenderType implements BaseEnum<GenderType, Integer> {

    UNKNOWN("未知", 0),

    BOY("男", 1),

    GIRL("女", 2),

    ERROR("数据错误", -1);

    private final String label;
    private final Integer value;

    GenderType(String label, Integer value) {
        this.label = label;
        this.value = value;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getLabel() {
        return this.label;
    }

    @Override
    public GenderType getEnum(Integer value) {
        if (null == value) {
            return ERROR;
        }
        for (GenderType e : values()) {
            if (e.value.equals(value)) {
                return e;
            }
        }
        return ERROR;
    }

}